﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Engine.Classes {
    import flash.events.*;
    import flash.display.*;
    import flash.geom.*;
    import Engine.*;

    public class Asset implements IEventDispatcher {

        public static const THUMBNAIL_DEFAULT_WIDTH:int = 64;
        public static const THUMBNAIL_DEFAULT_HEIGHT:int = 64;
        public static const THUMBNAIL_DEFAULT_BITMAP_WIDTH:int = 50;
        public static const THUMBNAIL_DEFAULT_BITMAP_HEIGHT:int = 50;

        protected var m_referenceCount:int = 0;
        protected var m_dispatcher:EventDispatcher;
        protected var m_imageFullPath:String = "";
        protected var m_id:Number = 0;
        protected var m_thumbnailBitmapData:BitmapData;	// 默认的位图

        public function Asset(){
            this.generateDefaultThumbnailBitmapData();
            this.m_dispatcher = new EventDispatcher(this);
        }
        public function dispose():void{
            if (this.m_thumbnailBitmapData != null){
                this.m_thumbnailBitmapData.dispose();
            };
        }
        protected function generateDefaultThumbnailBitmapData():void{
            this.m_thumbnailBitmapData = new BitmapData(THUMBNAIL_DEFAULT_BITMAP_WIDTH, THUMBNAIL_DEFAULT_BITMAP_HEIGHT, true, 0);
        }
        public function getType():String{
            return (Constants.ASSET_NONE);
        }
        public function parseData(_arg1:Object):void{
            this.m_imageFullPath = _arg1.imageFullPath;
            this.m_id = _arg1.id;
        }
        public function loadThumbnail():void{
        }
        public function isFullyLoaded():Boolean{
            return ((this.m_id > 0));
        }
        public function getThumbnailURL():String{
            return (null);
        }
        public function getThumbnail():DisplayObject{
            return (null);
        }
        public function getThumbnailBitmapData():BitmapData{
            return (this.m_thumbnailBitmapData);
        }
        protected function drawThumbnailBitmapData(_arg1:DisplayObject):void{
            var _local2:Matrix = new Matrix();
            _local2.scale((THUMBNAIL_DEFAULT_BITMAP_WIDTH / _arg1.width), (THUMBNAIL_DEFAULT_BITMAP_HEIGHT / _arg1.height));
            this.m_thumbnailBitmapData.draw(_arg1, _local2, null, null, null, true);
        }
        public function getImageFullPath():String{
            return (this.m_imageFullPath);
        }
        public function getInstanceCount():int{
            return (0);
        }
        public function equals(_arg1:Asset):Boolean{
            return ((this.m_id == _arg1.m_id));
        }
        public function getId():Number{
            return (this.m_id);
        }
        public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
            this.m_dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4);
        }
        public function dispatchEvent(_arg1:Event):Boolean{
            return (this.m_dispatcher.dispatchEvent(_arg1));
        }
        public function hasEventListener(_arg1:String):Boolean{
            return (this.m_dispatcher.hasEventListener(_arg1));
        }
        public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
            this.m_dispatcher.removeEventListener(_arg1, _arg2, _arg3);
        }
        public function willTrigger(_arg1:String):Boolean{
            return (this.m_dispatcher.willTrigger(_arg1));
        }

    }
}//package Engine.Classes 
